#!/usr/bin/env python3

import fileinput, os

errors = [
  'error: resource://gre/modules/ComponentUtils.jsm',
  "Syntax Error: Couldn't read xref table",
  'pdfinfo returned exit status 1"',
  'pdftotext returned exit status 1',
  'has reached its Zotero File Storage quota',
  'resource://gre/modules/addons/XPIProvider.jsm, line 1920: Error: Cannot find loader for bootstrap',
  'resource://zotero/bluebird/util.js, line 205: unreachable code after return statement',
  'error: resource://gre/modules/addons/XPIProvider.jsm, line 1710: Error: Addon must include an id, version, and type',
  'error: resource://gre/modules/amInstallTrigger.jsm, line 52: TypeError: this.mm is null',
  'JavaScript error: , line 0: uncaught exception: undefined',
]
for line in fileinput.input(files=(os.path.expanduser('~/.BBTTEST.log'),), encoding='utf-8', inplace=True):
  if any([error in line for error in errors]): continue
  print(line, end='')
